const siteId = 12

function getQueryVariable(variable) {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) { return pair[1]; }
    }
    return (false);
}

// function getAdData() {
//     var adjs = document.createElement('script')
//     adjs.async = 'async'
//     adjs.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8180331903483073'
//     adjs.crossorigin = 'anonymous'
//     adjs.setAttribute("data-ad-frequency-hint", "30s");
//     adjs.setAttribute("data-ad-channel", 7988871890);
//     // adjs.setAttribute("data-adbreak-test","on");

//     document.head.append(adjs)
// }

function getAdData() {
    var adJs = document.createElement('script')
    adJs.async = 'async'
    adJs.src = 'https://securepubads.g.doubleclick.net/tag/js/gpt.js'
    document.head.append(adJs)
}

window['addAds'] = function () {
    let childList = document.getElementsByClassName('ad-wrapper');
    for (let i = 0; i < childList.length; i++) {
        let insNode = childList[i].firstChild;
        insNode.style.maxWidth = childList[i].clientWidth || childList[i].offsetWidth;
        (adsbygoogle = window.adsbygoogle || []).push({});
    }
}

function shuffleArray(array) {
    for (let i = array.length - 1; i > 0; i--) {
        const j = Math.floor(Math.random() * (i + 1)); // 生成 0 到 i 之间的随机数
        [array[i], array[j]] = [array[j], array[i]]; // 交换 array[i] 和 array[j]
    }
    return array;
}